package com.iotechn.unimall.admin.api.purchaseOrder;

import com.iotechn.unimall.core.annotation.HttpMethod;
import com.iotechn.unimall.core.annotation.HttpOpenApi;
import com.iotechn.unimall.core.annotation.HttpParam;
import com.iotechn.unimall.core.annotation.HttpParamType;
import com.iotechn.unimall.core.annotation.param.NotNull;
import com.iotechn.unimall.core.exception.ServiceException;
import com.iotechn.unimall.data.domain.PurchaseOrderDO;
import com.iotechn.unimall.data.dto.purchase.PurchaseOrderDTO;
import com.iotechn.unimall.data.model.Page;

/**
 * 
 *
 * @author hct
 * @email 77802226@qq.com
 * @date 2021-04-01 10:58:13
 */
@HttpOpenApi(group = "admin.purchaseOrder", description = "")
public interface PurchaseOrderService{

    @HttpMethod(description = "列表", permission = "list", permissionParentName = "采购管理", permissionName = "列表")
    public Page<PurchaseOrderDO> list(
            @HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer page,
            @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页长度", valueDef = "20") Integer limit,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "创建", permission = "purchase:purchaseorder:create", permissionParentName = "采购管理", permissionName = "创建")
    String create(
            @NotNull @HttpParam(name = "purchaseOrderDTO", type = HttpParamType.COMMON, description = "") PurchaseOrderDTO purchaseOrderDTO,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "修改", permission = "purchase:purchaseorder:update", permissionParentName = "采购管理", permissionName = "修改")
    public String update(
            @NotNull @HttpParam(name = "purchaseOrderDTO", type = HttpParamType.COMMON, description = "") PurchaseOrderDTO purchaseOrderDTO,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "删除", permission = "purchase:purchaseorder:delete", permissionParentName = "采购管理", permissionName = "删除")
    public String delete(
            @NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "删除Id") Long id,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "详情", permission = "purchase:purchaseorder:detail", permissionParentName = "采购管理", permissionName = "详情")
    public PurchaseOrderDTO detail(
            @NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "Id") Long id,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;


    @HttpMethod(description = "审核", permission = "purchase:purchaseorder:audit", permissionParentName = "采购管理", permissionName = "审核")
    String audit(
            @NotNull @HttpParam(name = "pOrderId", description = "采购单ID") Long pOrderId,
            @HttpParam(name = "orderState", description = "采购单状态") Integer orderState,
            @HttpParam(name = "auditComment", description = "审核意见") String auditComment,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "确认", permission = "purchase:purchaseorder:updateConform", permissionParentName = "采购管理", permissionName = "确认")
    String updateConform(
            @NotNull @HttpParam(name = "purchaseOrderDTO", type = HttpParamType.COMMON, description = "") PurchaseOrderDTO purchaseOrderDTO,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    /**
     * 生成入库单
     * @param pOrderId
     * @param adminId
     * @return
     * @throws ServiceException
     */
    @HttpMethod(description = "生成入库单", permission = "purchase:purchaseorder:towareHouseOrder", permissionParentName = "采购管理", permissionName = "确认")
    String towareHouseOrder(
            @NotNull @HttpParam(name = "pOrderId", type = HttpParamType.COMMON, description = "") Long pOrderId,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;


}

